/*
#include <cmath>
#include <vector>
#include<iostream>
#include<string>

class Solution {
public:
    int superpalindromesInRange(std::string left, std::string right) {
      
        long long l = std::stoll(left);
        long long  r= std::stoll(right);

           long long limit = static_cast<long>(std::sqrt(static_cast<double>(r)));

        long long seed = 1;

         long long num = 0;
        int ans = 0;
        do
        {
            num =evenE(seed);
      
            if (check((__int128)num * num,l,r))
            {
                ans++;
            }
            num = odd(seed);
        
            if (check((__int128)num * num,l,r))
            {
                ans++;
            }
            seed++;
        }while (num<limit);
        return ans;
    }

    long long odd(   long long seed)
    {
          long long ans = seed;
        seed /= 10;
        while (seed != 0)
        {
            ans = ans*10 +seed % 10;
            seed /= 10;
        }
        return ans;
    }

      long long evenE(   long long seed)
    {
          long long ans = seed;
        while (seed != 0)
        {
            ans = ans * 10 + seed %10;
            seed /= 10;
        }
        return ans;
    }
    bool check(   __int128 ans,   long long l,   long long r)
    {
        return ans >= l && ans <= r &&isP(ans);
    }
    bool isP(   long long s)
    {
           long long offset = 1;
        while (s/offset >=10)
        {
            offset*=10;
        }

        while (s!=0)
        {
            if (s/offset != s % 10)
            {
                return false;
            }
           s = (s% offset) / 10;
            offset /= 100;
        }
        return true;
    }
};
*/
